<template>
    <div id="app">
        <scale-box v-if="is1080" :width="1950" :height="1080" bgc="transparent" :delay="100" isFlat>
            <router-view/>
            <theme-picker/>
        </scale-box>
        <template v-else>
            <router-view/>
            <theme-picker/>
        </template>
    </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";
import ScaleBox from "vue2-scale-box";
import {getConfigKeyNotLogin} from "@/api/system/config";

export default {
    name: "App",
    provide() {
        return {
            reload: this.reload,
        }
    },
    data() {
        return {
            isRouterAlive: true,
            is1080: false,
        }
    },
    components: {ThemePicker, ScaleBox},
    created() {
        getConfigKeyNotLogin("system.resolution_ratio.1080").then(response=>{
            this.is1080 = response.data.configValue == 'true';
        })
    },
    metaInfo() {
        return {
            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
            titleTemplate: title => {
                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
            }
        }
    },
    methods: {
        reload() {
            this.isRouterAlive = false
            this.$nextTick(function () {
                this.isRouterAlive = true
            })
        }
    }
};
</script>
<style scoped>
#app .theme-picker {
    display: none;
}
</style>
